const express = require('express')

const app = express()

let a = 100

app.get('/:username/:id', (req, res, next) => {
    let username = req.params['username']
    // if (检索数据库)
    // 伪代码
    const DATABASE_USERNAME = 'guaguaerhao'
    if (username === DATABASE_USERNAME) {
        console.log('1')
        res.end('用户信息')
    } else {
        next()
    }
})

app.get('/admin/login', (req, res) => {
    console.log('2')
    res.send('管理员登录')
})

app.listen(3000)